package com.atguigu02.singleton;
//懒汉式
public class GirlFriend {
    public static void main(String[] args) {


    }
}
class  Girl{
//1构造器私有化
    private Girl(){

    }
   //2在类中声明对象（先不创建）
    //4静态化
   private static Girl instance=null;
    //3通过方法获取当前类的实例，若未创建，则创建
    private static Girl getInstance(){
        if(instance==null){
            instance=new Girl();
        }
        return instance;
    }
}